<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox-content">
					<form class="form-horizontal m-t" id="signupForm">
						<input id="xcxId" name="xcxId" th:value="${wx.id}"
							type="hidden">
							<input id="id" name="id" th:value="${spjc}==null?null:${spjc.id}"
							type="hidden">
						<div class="form-group">
							<label class="col-sm-3 control-label">小程序名称：</label>
							<div class="col-sm-8">
								<input id="xcxName" name="xcxName" class="form-control" type="text"
									th:value="${wx.title}">
							</div>
						</div>
							
							<div class="form-group">
								<input id="content" name="content" th:value="${spjc}==null?null:${spjc.spjc}" type="hidden"> <label
									class="col-sm-1 control-label">教程描述：</label>
								<div class="col-sm-11">
									<div class="ibox-content no-padding">
										<div id="content_sn" class="summernote"></div>
									</div>
								</div>
							</div> 
						</div>
						<div class="text-right form-group">
								<a class="btn btn-default waves-effect waves-light"
									onclick="returnList()">返回列表</a>
								<button type="button"
									class="btn btn-primary waves-effect waves-light"
									onclick="save()">保存</button>
							</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<div th:include="include::footer"></div>
	<script src="/js/layui.js"></script>
	<script src="/js/plugins/layer/layer.min.js"></script>
	<script src="/kindeditor/kindeditor-all-min.js"></script>
	<script src="/kindeditor/lang/zh-CN.js"></script>
	<script src="/kindeditor/plugins/code/prettify.js"></script>
	<script src="/js/plugins/layer/layer.min.js"></script>
	<script type="text/javascript">
	$('.summernote').summernote({
		height : '220px',
		lang : 'zh-CN',
		callbacks: {
            onImageUpload: function(files, editor, $editable) {
                sendFile(files);
            }
        }
	});
	
	var content = $("#content").val();
	$('#content_sn').summernote('code', content);
	
	function save() {
		var id = $("#id").val();
		var xcxId = $("#xcxId").val();
		var xcxName = $("#xcxName").val();
		var spjc = $("#content_sn").summernote('code');
		$.ajax({
	        type: 'post',
	        url: '/config/gzhConfig/spjcUpdate',
	        data: {id:id,spjc: spjc,xcxId:xcxId,xcxName:xcxName},
	        success: function(data){
	        	if(data.code == 0){
	        		parent.layer.msg("操作成功");
					parent.reLoad();
					var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
					parent.layer.close(index);
				} else {
					parent.layer.alert(data.msg)
				}
	        }
	    });
	}
</script>
	
</body>
</html>
